//
// Created by 12992 on 24-10-15.
//

#ifndef MEDIA_TRANSCODER_VIDEOPREVIEW_H
#define MEDIA_TRANSCODER_VIDEOPREVIEW_H

#include <QWidget>

namespace gui::widgets
{
    QT_BEGIN_NAMESPACE
    namespace Ui { class VideoPreview; }
    QT_END_NAMESPACE

    class VideoPreview : public QWidget
    {
    Q_OBJECT

    public:
        explicit VideoPreview(QWidget* parent = nullptr);

        explicit VideoPreview(const QVector<QImage>& images, QWidget* parent = nullptr);

        ~VideoPreview() override;

        void addImage(const QImage& image);

        void clear();

    private:
        void init_without_image();

        void init_signals();

        void init_with_image(const QVector<QImage>& images);

        void new_image(const QImage& image);

    private slots:

        void nextPage();

        void prevPage();

    private:
        Ui::VideoPreview* ui;
        int current_index{0};
        bool is_empty{};
    };
} // gui::widgets

#endif //MEDIA_TRANSCODER_VIDEOPREVIEW_H
